\(\int \frac {1+a x}{x \sqrt {a x} \sqrt {1-a x}} \, dx\) [26]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [C] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 26, antiderivative size = 29 \[ \int \frac {1+a x}{x \sqrt {a x} \sqrt {1-a x}} \, dx=-\frac {2 \sqrt {1-a x}}{\sqrt {a x}}-\arcsin (1-2 a x) \]

[Out]

arcsin(2*a*x-1)-2*(-a*x+1)^(1/2)/(a*x)^(1/2)

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.192, Rules used = {16, 79, 55, 633, 222} \[ \int \frac {1+a x}{x \sqrt {a x} \sqrt {1-a x}} \, dx=-\arcsin (1-2 a x)-\frac {2 \sqrt {1-a x}}{\sqrt {a x}} \]

[In]

Int[(1 + a*x)/(x*Sqrt[a*x]*Sqrt[1 - a*x]),x]

[Out]

(-2*Sqrt[1 - a*x])/Sqrt[a*x] - ArcSin[1 - 2*a*x]

Rule 16

Int[(u_.)*(v_)^(m_.)*((b_)*(v_))^(n_), x_Symbol] :> Dist[1/b^m, Int[u*(b*v)^(m + n), x], x] /; FreeQ[{b, n}, x
] && IntegerQ[m]

Rule 55

Int[1/(Sqrt[(a_) + (b_.)*(x_)]*Sqrt[(c_.) + (d_.)*(x_)]), x_Symbol] :> Int[1/Sqrt[a*c - b*(a - c)*x - b^2*x^2]
, x] /; FreeQ[{a, b, c, d}, x] && EqQ[b + d, 0] && GtQ[a + c, 0]

Rule 79

Int[((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Simp[(-(b*e - a*f
))*(c + d*x)^(n + 1)*((e + f*x)^(p + 1)/(f*(p + 1)*(c*f - d*e))), x] - Dist[(a*d*f*(n + p + 2) - b*(d*e*(n + 1
) + c*f*(p + 1)))/(f*(p + 1)*(c*f - d*e)), Int[(c + d*x)^n*(e + f*x)^(p + 1), x], x] /; FreeQ[{a, b, c, d, e,
f, n}, x] && LtQ[p, -1] && ( !LtQ[n, -1] || IntegerQ[p] ||  !(IntegerQ[n] ||  !(EqQ[e, 0] ||  !(EqQ[c, 0] || L
tQ[p, n]))))

Rule 222

Int[1/Sqrt[(a_) + (b_.)*(x_)^2], x_Symbol] :> Simp[ArcSin[Rt[-b, 2]*(x/Sqrt[a])]/Rt[-b, 2], x] /; FreeQ[{a, b}
, x] && GtQ[a, 0] && NegQ[b]

Rule 633

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Dist[1/(2*c*(-4*(c/(b^2 - 4*a*c)))^p), Subst[Int[Si
mp[1 - x^2/(b^2 - 4*a*c), x]^p, x], x, b + 2*c*x], x] /; FreeQ[{a, b, c, p}, x] && GtQ[4*a - b^2/c, 0]

Rubi steps \begin{align*} \text {integral}& = a \int \frac {1+a x}{(a x)^{3/2} \sqrt {1-a x}} \, dx \\ & = -\frac {2 \sqrt {1-a x}}{\sqrt {a x}}+a \int \frac {1}{\sqrt {a x} \sqrt {1-a x}} \, dx \\ & = -\frac {2 \sqrt {1-a x}}{\sqrt {a x}}+a \int \frac {1}{\sqrt {a x-a^2 x^2}} \, dx \\ & = -\frac {2 \sqrt {1-a x}}{\sqrt {a x}}-\frac {\text {Subst}\left (\int \frac {1}{\sqrt {1-\frac {x^2}{a^2}}} \, dx,x,a-2 a^2 x\right )}{a} \\ & = -\frac {2 \sqrt {1-a x}}{\sqrt {a x}}-\sin ^{-1}(1-2 a x) \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(68\) vs. \(2(29)=58\).

Time = 0.09 (sec) , antiderivative size = 68, normalized size of antiderivative = 2.34 \[ \int \frac {1+a x}{x \sqrt {a x} \sqrt {1-a x}} \, dx=\frac {2 \left (-1+a x+2 \sqrt {a} \sqrt {x} \sqrt {1-a x} \arctan \left (\frac {\sqrt {a} \sqrt {x}}{-1+\sqrt {1-a x}}\right )\right )}{\sqrt {-a x (-1+a x)}} \]

[In]

Integrate[(1 + a*x)/(x*Sqrt[a*x]*Sqrt[1 - a*x]),x]

[Out]

(2*(-1 + a*x + 2*Sqrt[a]*Sqrt[x]*Sqrt[1 - a*x]*ArcTan[(Sqrt[a]*Sqrt[x])/(-1 + Sqrt[1 - a*x])]))/Sqrt[-(a*x*(-1
 + a*x))]

Maple [A] (verified)

Time = 1.54 (sec) , antiderivative size = 38, normalized size of antiderivative = 1.31

method result size
meijerg \(\frac {2 \sqrt {a}\, \sqrt {x}\, \arcsin \left (\sqrt {a}\, \sqrt {x}\right )}{\sqrt {a x}}-\frac {2 \sqrt {-a x +1}}{\sqrt {a x}}\) \(38\)
default \(\frac {\sqrt {-a x +1}\, \left (\arctan \left (\frac {\operatorname {csgn}\left (a \right ) \left (2 a x -1\right )}{2 \sqrt {-x \left (a x -1\right ) a}}\right ) a x -2 \,\operatorname {csgn}\left (a \right ) \sqrt {-x \left (a x -1\right ) a}\right ) \operatorname {csgn}\left (a \right )}{\sqrt {a x}\, \sqrt {-x \left (a x -1\right ) a}}\) \(69\)
risch \(\frac {2 \left (a x -1\right ) \sqrt {a x \left (-a x +1\right )}}{\sqrt {-x \left (a x -1\right ) a}\, \sqrt {a x}\, \sqrt {-a x +1}}+\frac {a \arctan \left (\frac {\sqrt {a^{2}}\, \left (x -\frac {1}{2 a}\right )}{\sqrt {-a^{2} x^{2}+a x}}\right ) \sqrt {a x \left (-a x +1\right )}}{\sqrt {a^{2}}\, \sqrt {a x}\, \sqrt {-a x +1}}\) \(103\)

[In]

int((a*x+1)/x/(a*x)^(1/2)/(-a*x+1)^(1/2),x,method=_RETURNVERBOSE)

[Out]

2*a^(1/2)/(a*x)^(1/2)*x^(1/2)*arcsin(a^(1/2)*x^(1/2))-2*(-a*x+1)^(1/2)/(a*x)^(1/2)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 47 vs. \(2 (23) = 46\).

Time = 0.24 (sec) , antiderivative size = 47, normalized size of antiderivative = 1.62 \[ \int \frac {1+a x}{x \sqrt {a x} \sqrt {1-a x}} \, dx=-\frac {2 \, {\left (a x \arctan \left (\frac {\sqrt {a x} \sqrt {-a x + 1}}{a x}\right ) + \sqrt {a x} \sqrt {-a x + 1}\right )}}{a x} \]

[In]

integrate((a*x+1)/x/(a*x)^(1/2)/(-a*x+1)^(1/2),x, algorithm="fricas")

[Out]

-2*(a*x*arctan(sqrt(a*x)*sqrt(-a*x + 1)/(a*x)) + sqrt(a*x)*sqrt(-a*x + 1))/(a*x)

Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 3.44 (sec) , antiderivative size = 71, normalized size of antiderivative = 2.45 \[ \int \frac {1+a x}{x \sqrt {a x} \sqrt {1-a x}} \, dx=a \left (\begin {cases} - \frac {2 i \operatorname {acosh}{\left (\sqrt {a} \sqrt {x} \right )}}{a} & \text {for}\: \left |{a x}\right | > 1 \\\frac {2 \operatorname {asin}{\left (\sqrt {a} \sqrt {x} \right )}}{a} & \text {otherwise} \end {cases}\right ) + \begin {cases} - 2 \sqrt {-1 + \frac {1}{a x}} & \text {for}\: \frac {1}{\left |{a x}\right |} > 1 \\- 2 i \sqrt {1 - \frac {1}{a x}} & \text {otherwise} \end {cases} \]

[In]

integrate((a*x+1)/x/(a*x)**(1/2)/(-a*x+1)**(1/2),x)

[Out]

a*Piecewise((-2*I*acosh(sqrt(a)*sqrt(x))/a, Abs(a*x) > 1), (2*asin(sqrt(a)*sqrt(x))/a, True)) + Piecewise((-2*
sqrt(-1 + 1/(a*x)), 1/Abs(a*x) > 1), (-2*I*sqrt(1 - 1/(a*x)), True))

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 41, normalized size of antiderivative = 1.41 \[ \int \frac {1+a x}{x \sqrt {a x} \sqrt {1-a x}} \, dx=-\frac {2 \, \sqrt {-a^{2} x^{2} + a x}}{a x} - \arcsin \left (-\frac {2 \, a^{2} x - a}{a}\right ) \]

[In]

integrate((a*x+1)/x/(a*x)^(1/2)/(-a*x+1)^(1/2),x, algorithm="maxima")

[Out]

-2*sqrt(-a^2*x^2 + a*x)/(a*x) - arcsin(-(2*a^2*x - a)/a)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 51 vs. \(2 (23) = 46\).

Time = 0.28 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.76 \[ \int \frac {1+a x}{x \sqrt {a x} \sqrt {1-a x}} \, dx=\frac {2 \, a \arcsin \left (\sqrt {a x}\right ) - \frac {a {\left (\sqrt {-a x + 1} - 1\right )}}{\sqrt {a x}} + \frac {\sqrt {a x} a}{\sqrt {-a x + 1} - 1}}{a} \]

[In]

integrate((a*x+1)/x/(a*x)^(1/2)/(-a*x+1)^(1/2),x, algorithm="giac")

[Out]

(2*a*arcsin(sqrt(a*x)) - a*(sqrt(-a*x + 1) - 1)/sqrt(a*x) + sqrt(a*x)*a/(sqrt(-a*x + 1) - 1))/a

Mupad [B] (verification not implemented)

Time = 3.24 (sec) , antiderivative size = 47, normalized size of antiderivative = 1.62 \[ \int \frac {1+a x}{x \sqrt {a x} \sqrt {1-a x}} \, dx=-\frac {2\,\sqrt {1-a\,x}}{\sqrt {a\,x}}-\frac {4\,a\,\mathrm {atan}\left (\frac {a\,\left (\sqrt {1-a\,x}-1\right )}{\sqrt {a\,x}\,\sqrt {a^2}}\right )}{\sqrt {a^2}} \]

[In]

int((a*x + 1)/(x*(a*x)^(1/2)*(1 - a*x)^(1/2)),x)

[Out]

- (2*(1 - a*x)^(1/2))/(a*x)^(1/2) - (4*a*atan((a*((1 - a*x)^(1/2) - 1))/((a*x)^(1/2)*(a^2)^(1/2))))/(a^2)^(1/2
)